<template>
	<view>
		<view class='body' v-if="agree">
			<uni-icons type="checkbox-filled" color="#1aad19" size="24"></uni-icons>
			<view class="suc-text" @click="toAgreement">您已确认同意开户协议内容</view>
		</view>
		<view class='body' v-else>
			<uni-icons type="info-filled" color="#F44336" size="24"></uni-icons>
			<view class="err-text" @click="toAgreement">点击查看开户协议，并确认同意协议内容</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				agree: false
			}
		},
		methods: {
			toAgreement() {
				let that = this
				uni.navigateTo({
					url: '/pages/agreement/index',
					events: {
					    // 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
					    changeAgreement: function(data) {
								if(data.agree) {
									that.agree = true
									that.$emit('input', data.file_no)
								}
					    }
					  },
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.body {
		padding: 40rpx 0;
		display: flex;
		align-items: center;
		
	}
	
	.err-text {
		color: #F44336;
		text-decoration: underline;
	}
	
	.suc-text {
		color: #1aad19;
		text-decoration: underline;
	}
</style>